1. Field of the Invention
This invention relates to graphical user interfaces, and more particularly to apparatus and methods for handling user-interface gestures in non-rectangular regions.
2. Background of the Invention
In software products in which a user interface (UI) is created using a scripting language, such as JAVASCRIPT™ it is very common to have script executed when a mouse pointer enters or exits a section of the UI. (JAVASCRIPT is a registered trademark or common law mark of Sun Microsystems in the United States and/or other countries.) This allows for advanced behaviors such as visual feedback to the user, or dynamic fetching of content when the user interacts with portions of the UI. The scripting language typically makes this simple for single rectangular elements of the UI by allowing a programmer to attach an event handler to the onmouseover and onmouseout events of DOM nodes in the HTML markup. Areas of interest in an HTML page, however, can often be made up of many DOM nodes which together do not necessarily form a rectangular region. Since the DOM events in the browser are generated from single DOM nodes, it can be difficult to determine if a mouse pointer entered or exited a region (i.e., a group of DOM nodes as a whole), or just a DOM node within the group of DOM nodes making up the region.
There are a number of techniques that may be used to circumvent the above-described limitation, each with its own pitfalls. For example, a single rectangular parent DOM node may be used to detect the events for all of its children DOM nodes. This solution is simple but is limited to rectangular regions and requires that all DOM nodes in the group be descendents of the parent node generating the events. Alternatively, the position of a mouse pointer may be tracked as the mouse pointer moves over an ancestor DOM node of a DOM node of interest. The coordinates of the mouse pointer may be checked to see if it is over the DOM node of interest. This solution can be expensive and may decrease performance within the browser as it may cause many mouse move events to be generated. Alternatively, image maps may be used on images to detect polygonal regions. This solution, however, is limited to images.
In view of the foregoing, what are needed are apparatus and methods to handle user-interface gestures in non-rectangular regions of a user interface. More specifically, apparatus and methods are needed to efficiently control the behavior of groups of graphical elements, such as groups of DOM nodes. Ideally, such an apparatus and method would provide excellent performance within a browser.